<?php

namespace App\Imports;

use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\Importable;

class excelImport implements ToCollection
{
    use Importable;

    /**
     * @param Collection $collection
     */
    public function collection(Collection $collection)
    {
        var_dump($collection);die;
    }

    public function model(array $row)
    {
        var_dump($row);die;
        // 这里处理每行的数据
        return YourModel::create([
            'column1' => $row[0],
            'column2' => $row[1],
            // 其他字段...
        ]);
    }
}
